import Vue from 'vue'
import VueRouter from 'vue-router'

import Zzgk from '../views/zzgk.vue'
import Dydw from '../views/dydw.vue'
import Jczz from '../views/jczz.vue'
import Dwgz from '../views/dwgz.vue'
import Sxjs from '../views/sxjs.vue'
import Zbdt from '../views/zbdt.vue'

Vue.use(VueRouter)
const router = new VueRouter({
    routes: [
        {
            // 组织概况
            path: '/zzgk',
            component: Zzgk
        },
        {
            // 党员队伍
            path: '/dydw',
            component: Dydw
        },
        {
            // 基层组织
            path: '/jczz',
            component: Jczz
        },
        {
            // 党务工作
            path: '/dwgz',
            component: Dwgz
        },
        {
            // 思想建设
            path: '/sxjs',
            component: Sxjs
        },
        {
            // 支部地图
            path: '/zbdt',
            component: Zbdt
        }, {
            // 重定向
            path: '/',
            redirect: '/zzgk'
        }
    ]
})
// 前置守卫
router.beforeEach((to, from, next) => {
    //   if (to.path == '/login') {
    //     next();
    //   } else {
    //     setTimeout(()=>{
    //       let userId = router.app.$options.store.state.userid;
    //       if (!userId) {
    //         next('/login');
    //       } else {
    //         next();
    //       }

    //     })
    //   }
    next()
});
export default router